/**
 * 初始化
 */
function init() {
	var selectedLanmuNode;

	var viewport = new Ext.Viewport({
		layout : 'border',
		items : [new Ext.tree.TreePanel({
			region : 'west',
			id : 'treePanel',
			title : '专题/栏目',
			split : false,
			width : 200,
			minSize : 175,
			maxSize : 250,
			collapsible : false,
			layout : 'fit',
			layoutConfig : {
				animate : true
			},
			frame : false,
			checkModel : 'single',
			// onlyLeafCheckable : true,
			autoScroll : true,
			animate : true,
			rootVisible : false,
			loader : new Ext.tree.TreeLoader({
						dataUrl : context
								+ '/app/info.do?method=directorytree4manager&id=0',
						baseParams : {
			// active : 'purview4GUSelectForm'
						}
					}),
			root : new Ext.tree.AsyncTreeNode({
						allowChildren : true,
						expanded : true,
						text : 'root', // 节点名称
						draggable : false, // 是否支持拖动
						id : '-1'
					}),
			listeners : {
				'click' : function(node) {
					/*
					 * if (node.isExpanded()) { node.collapse(); } else {
					 * node.expand(); }
					 */

					neuinfo(node);
				},
				'checkchange' : function(node, checked) {
					if (checked) {
						if (selectedLanmuNode) {
							selectedLanmuNode.attributes.checked = false;
							selectedLanmuNode.ui.checkbox.checked = false;
						}

						selectedLanmuNode = node;
					}
				}
			}
		}), {
			region : 'center',
			layout : 'fit',
			autoScroll : true,
			title : '信息发布',
			html : '<iframe id="frm" width="100%" height="100%" frameborder="0" src="'
					+ context + '/system/blank.jsp"></iframe>'
		}]
	});

	Ext.getCmp('treePanel').getRootNode().expand(true);
}

/**
 * 新建内容信息
 * 
 * @param {}
 *            id
 */
function neuinfo(node) {
	if (node.id != '0') {
		//var url = context + '/app/info.do?method=neuinfo&did=' + node.id;
		var url = context + '/system/tablequery/jsplist.jsp?queryKey=myinfolist&did=' + node.id;

		if (Ext.get('frm')) {
			Ext.get('frm').dom.src = url;
		}
	}
}